﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Xml;
using System.Xml.Xsl;
using Ext.Net;

public partial class listcustomersdeneme : System.Web.UI.Page
{
    protected void Page_Load(object sender, StoreRefreshDataEventArgs e)
    {
        if (!X.IsAjaxRequest)
        {
            this.Store1.DataSource = this.GetDataReader();
            this.Store1.DataBind();
        }
    }

    protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
    {
        this.Store1.DataSource = this.GetDataReader();
        this.Store1.DataBind();
    }

    private SqlDataReader GetDataReader()
    {
        SqlConnection myConnection;
        SqlCommand myCommand;
        SqlDataReader myDataReader;

        string strConn = System.Configuration.ConfigurationManager.ConnectionStrings["SiyahBayrakConnectionString"].ConnectionString;

        myConnection = new SqlConnection(strConn);
        myConnection.Open();

        myCommand = new SqlCommand("listClients", myConnection);
        myCommand.CommandType = System.Data.CommandType.StoredProcedure;
        myDataReader = myCommand.ExecuteReader();

        return myDataReader;
    }

    [DirectMethod]
    public void viewClient(int customerID)
    {
        if (customerID == 1)
            Response.Redirect("http://goole.com");
        if (customerID == 2)
            Response.Redirect("http://bing.com");
    }
}